<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Login Page</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            display: flex;
            justify-content: center;
            align-items: center;
            height: 100vh;
            background-color: #f0f0f0;
        }
        .login-container {
            background-color: #fff;
            padding: 20px;
            border-radius: 8px;
            box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
            width: 300px;
            text-align: center;
        }
        .login-container input {
            width: 100%;
            padding: 10px;
            margin: 10px 0;
            border: 1px solid #ccc;
            border-radius: 4px;
        }
        .login-container button {
            width: 100%;
            padding: 10px;
            background-color: #007BFF;
            color: #fff;
            border: none;
            border-radius: 4px;
            cursor: pointer;
        }
        .login-container button:hover {
            background-color: #0056b3;
        }
    </style>
</head>
<body>
<div class="login-container">
    <h2>Login</h2>
    <input type="text" id="account" placeholder="Account" required>
    <input type="password" id="password" placeholder="Password" required>
    <button onclick="submitLogin()">Login</button>
</div>

<script>
    function submitLogin() {
        const account = document.getElementById('account').value;
        const password = document.getElementById('password').value;
        const orderInfo = {
            account: account,
            password: password
        };

        fetch('/order/submit', {
            method: 'POST',
            headers: {
                'Content-Type': 'application/json'
            },
            body: JSON.stringify({ orderInfo: orderInfo })
        })
            .then(response => response.json())
            .then(data => {
                console.log('Success:', data);
                // 在这里可以添加登录成功后的处理逻辑，比如跳转到另一个页面
                alert('Login successful!');
            })
            .catch((error) => {
                console.error('Error:', error);
                alert('Login failed!');
            });
    }
</script>
</body>
</html>